package com.sms.shared;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
@Entity
@Table(name="equipment")
public class Equipment implements Serializable{
	
	public Equipment(){
		
	}
	
	@Id
	@GenericGenerator(name = "generator", strategy = "increment")
    @GeneratedValue(generator = "generator")
	@Column(name = "Id")
	private Long id;
	@Column(name = "serialNo", nullable = false, length = 50)
	private String serialNo;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name = "siteId", insertable = true, updatable = true)
	private Site site;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name = "configurationId", insertable = true, updatable = true)
	private Configuration configuration;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name = "parsingMethodId", insertable = true, updatable = true)
	private ParsingMethod parsingMethod;
	
	@Column(name = "createdDate")
	private java.util.Date createdDate;
	
	@Column(name = "updatedDate")
	private java.util.Date updatedDate;
	
	@Column(name = "groupNo", nullable = false, length = 50)
	private String groupNo;
	
	@Column(name = "displayGroupNo", nullable = false, length = 50)
	private String displayGroupNo;
	
	@Column
	private Boolean isThreePhase;
	
	@Column(name = "capacity")
	private String capacity;
	
	@OneToMany(cascade = CascadeType.ALL,fetch=FetchType.LAZY)
	@JoinColumn(name = "equipmentId")
	private Set<EquipmentReading> equipmentReadings = new HashSet<EquipmentReading>();

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getSerialNo() {
		return serialNo;
	}

	public void setSerialNo(String serialNo) {
		this.serialNo = serialNo;
	}

	public Site getSite() {
		return site;
	}

	public void setSite(Site site) {
		this.site = site;
	}

	public java.util.Date getCreatedDate() {
		return createdDate;
	}

	public void setCreatedDate(java.util.Date createdDate) {
		this.createdDate = createdDate;
	}

	public java.util.Date getUpdatedDate() {
		return updatedDate;
	}

	public void setUpdatedDate(java.util.Date updatedDate) {
		this.updatedDate = updatedDate;
	}

	public Configuration getConfiguration() {
		return configuration;
	}

	public void setConfiguration(Configuration configuration) {
		this.configuration = configuration;
	}

	public Set<EquipmentReading> getEquipmentReadings() {
		return equipmentReadings;
	}

	public void setEquipmentReadings(Set<EquipmentReading> equipmentReadings) {
		this.equipmentReadings = equipmentReadings;
	}

	public String getGroupNo() {
		return groupNo;
	}

	public void setGroupNo(String groupNo) {
		this.groupNo = groupNo;
	}

	public String getDisplayGroupNo() {
		return displayGroupNo;
	}

	public void setDisplayGroupNo(String displayGroupNo) {
		this.displayGroupNo = displayGroupNo;
	}

	public Boolean getIsThreePhase() {
		return isThreePhase;
	}

	public void setIsThreePhase(Boolean isThreePhase) {
		this.isThreePhase = isThreePhase;
	}

	public ParsingMethod getParsingMethod() {
		return parsingMethod;
	}

	public void setParsingMethod(ParsingMethod parsingMethod) {
		this.parsingMethod = parsingMethod;
	}

	public String getCapacity() {
		return capacity;
	}

	public void setCapacity(String capacity) {
		this.capacity = capacity;
	}
	
	
	
}
